<#if formField.hidden?? && formField.hidden=="1">
<input type=hidden name="fieldMap['${field.name}'].id"  <#if businessInstanceField?? && businessInstanceField.id??>value="${businessInstanceField.id}"</#if>>
<input type=hidden name="fieldMap['${field.name}'].field.id"  value="${formField.field.id}">
<input type=hidden id=${field.name} name="fieldMap['${field.name}'].value" <#if businessInstanceField??>value="${businessInstanceField.value?default('')}" </#if>></input>
<#else>
<input type=hidden name="fieldMap['${field.name}'].id"  <#if businessInstanceField?? && businessInstanceField.id??>value="${businessInstanceField.id}"</#if>>
<input type=hidden name="fieldMap['${field.name}'].field.id"  value="${formField.field.id}">
<#if formField.readonly?? && formField.readonly=="1">
<#if businessInstanceField?? && businessInstanceField.value??>${businessInstanceField.value}</#if>
<#else>
<input type="text"  <#if fieldrule??> datarule="${fieldrule.dataType}"  datarulejson='${fieldrule.json}'  </#if> name="fieldMap['${field.name}'].value" <#if businessInstanceField?? && businessInstanceField.value??>value="${businessInstanceField.value}"</#if> readonly="readonly" id="company${field.name}" class="textTest"/>
</#if>
<input type="hidden" name="fieldMap['${field.name}'].entityId" <#if businessInstanceField?? && businessInstanceField.entityId??>value="${businessInstanceField.entityId}"</#if> id="companyId${field.name}"/>
<#if !formField.readonly?? || formField.readonly=="0">
<script language="JavaScript">
var zTreeObj${field.name};
var	setting${field.name};
	$(document).ready(function() {
		
		$("#company${field.name}").inputStyle({
			operatorId:"companyMenuBtn${field.name}",
			operatorType:"text",
			operatorText:"选择",
			controllerWidth:'${formField.width}',
			operatorFun:popDD${field.name},
			imgFun:clearCheckbox${field.name}
		});
		
	});
	function zTreeOnClick${field.name}(event, treeId, treeNode) {
		    if (treeNode) {
				var cityObj = $("#company${field.name}");
				cityObj.val(treeNode.name);
				$('#companyId${field.name}').val(treeNode.id);				
				window.curDDWin.saveWin();

				 if(validator) {
					validator.element($(document.getElementById('company${field.name}')));
				 }

			}
		}
		
		function zTreeOnLoadAfter${field.name}(zTree, msg)
		{	
		   zTreeObj${field.name} = zTree;
		   //zTree.expandAll();
		   var nodes = zTree.setting.root['nodes'];
			for(var i=0;i<nodes.length;i++) {
				zTree.expandNode(nodes[i],true,false);
			}
		   var parentid = "";
		   if( parentid != '')	
		   {  
			   var node = zTree.getNodeByParam("id",parentid );             
			   zTree.selectNode(node);
		   }
		}
		
		function popDD${field.name}(){
		if(!zTreeObj${field.name}) {
		var projectType = '';
		if(document.getElementById('projectType')) {
			projectType = document.getElementById('projectType').value;
			if(projectType=='1') {
				if(document.getElementById('planitemVolclass') && (document.getElementById('planitemVolclass').value=='±800kV' || document.getElementById('planitemVolclass').value=='±500kV')) {
					projectType = '4';
				}
			}
		}
		setting${field.name} = {
		      	asyncUrl: TDQS.CONTEXT_PATH+"company/tree.action?projectType="+projectType,
		      	asyncParam : ["id"],
			callback:{
				    click: zTreeOnClick${field.name} ,
				    loadTreeSuccess:zTreeOnLoadAfter${field.name}
			}
		};
		$("#companyTree${field.name}").zTree(setting${field.name});
		}
		$("input[type='button']",$('.dropDD_contentDiv')).each(function(){
						this.style.backgroundImage="url(./../theme/default/images/main/btn_normal.png)";
						$(this).hover(function(){this.style.backgroundImage="url(./../theme/default/images/main/btn_over.png)";},function(){this.style.backgroundImage="url(./../theme/default/images/main/btn_normal.png)";});
					});
			new DDWin({
				el:'DropdownMenu${field.name}'
				,dep:'divAround_company${field.name}'
				,clickBody:'save'
			})
		}
		function clearCheckbox${field.name}(){
			$("#companyTree${field.name}").html("");
			$(document.getElementById('${field.name}')).val("");
			$(document.getElementById('company${field.name}')).val("");
			zTreeObj${field.name} = $("#companyTree${field.name}").zTree(setting${field.name});
		window.curDDWin.saveWin();

			 if(validator) {
			   validator.element($(document.getElementById('company${field.name}')));
			}
	
		}
</script>
<div id="DropdownMenu${field.name}" class="dropDD_contentDiv">
	<div style="overflow:auto;height:266px">
		<ul id="companyTree${field.name}" class="tree"></ul>			
	</div>
	<div class="buttonBox" style="position:absolute;bottom:0px;background:#f3f4f4;height:30px;padding-top:4px">
		<a href="javascript:void(0);" class="button" tabindex="-1"><input type="button" onclick="window.curDDWin.saveWin();return false;" value="确认"></a>
		<a href="javascript:void(0);" class="button" tabindex="-1"><input type="button" onclick="clearCheckbox${field.name}();return false;" value="清空"></a>
	</div>
</div>
</#if>
</#if>
